package com.itheima.demo02;

import java.util.Set;
import java.util.stream.Stream;

//Stream流终结操作方法
public class StreamClass06 {
    public static void main(String[] args) {
        Set<String> set = Set.of("aaa","bb","cccc");
        Stream<String> stream = set.stream();
        //method1(stream);
        //method2(stream);
    }

    private static void method2(Stream<String> stream) {
        System.out.println(stream.filter(s -> s.startsWith("a")).count());
    }

    private static void method1(Stream<String> stream) {
        stream.filter(s -> s.length() >= 3).forEach(s -> System.out.println(s));
    }
}
